﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Icms.Core.Model
{
    public class Case : DelEntity
    {
        public Guid? MainId { get; set; }
        public virtual Case Main { get; set; }
        public DateTime CreatedDate { get; set; }
        public string Number { get; set; }
        public string Title { get; set; }
        public string Nature { get; set; }
        public Guid TypeId { get; set; }
        public virtual Parameter Type { get; set; }
        public Guid IndexId { get; set; }
        public virtual Parameter Index { get; set; }
        public Guid TypeExamId { get; set; }
        public virtual Parameter TypeExam { get; set; }
        public Guid TypeInitialisationId { get; set; }
        public virtual Parameter TypeInitialisation { get; set; }
        public string RevisedNumber { get; set; }
        public string RevisedTitle { get; set; }
        public string Reference { get; set; }
        public bool IsSecret { get; set; }
        public string Comments { get; set; }
        public int Volumes { get; set; }
        public string Annex { get; set; }
        public Guid? CrimeEnvironmentId { get; set; }
        public string ProsecutorNumber { get; set; }
        public bool HasPleaBargaining { get; set; }
        public decimal StateFee { get; set; }
        public Guid? MainCaseTypeId { get; set; }
        public virtual CaseType MainCaseType { get; set; }
        public virtual ICollection<CaseType> CaseTypes { get; set; }
        public Guid CourtId { get; set; }
        public virtual Court Court { get; set; }
        public virtual ICollection<Status> Statuses { get; set; }
        public virtual ICollection<Party> Parties { get; set; }
        public virtual ICollection<File> Files { get; set; }
        public int RowRank;

    }

    public class Party : DelEntity
    {
        public Guid PersonId { get; set; }
        public virtual Person Person { get; set; }
        public Guid CaseId { get; set; }
        public virtual Case Case { get; set; }
        public Guid TypePartyId { get; set; }
        public virtual Parameter TypeParty { get; set; }
        public string Comments { get; set; }
        public DateTime DateAdd { get; set; }
        public DateTime? DateEnd { get; set; }
        public virtual ICollection<Hearing> Hearings { get; set; }
    }

    public class Person : Entity
    {
        public Guid? PersonId { get; set; }
        public Guid? RegionId { get; set; }
        public Guid? EducationId { get; set; }
        public Guid? OccupationId { get; set; }
        public bool PleaBargain { get; set; }
        public bool Minor { get; set; }
        public Guid? CitizenshipId { get; set; }
        public Guid? CatId { get; set; }
        public string Region { get; set; }
        public string TypeActivity { get; set; }
        public string Function { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string SurName { get; set; }
        public string Idnp { get; set; }
        public string Type { get; set; }
        public string Gender { get; set; }
        public string Location { get; set; }
        public string Street { get; set; }
        public string Home { get; set; }
        public string Appartment { get; set; }
        public string Phone { get; set; }
        public string CellPhone { get; set; }
        public string Email { get; set; }
        public string ContactInfo { get; set; }
        public DateTime? DateOfBirth { get; set; }
    }

    public class Participant : DelEntity
    {
        public Participant()
        {
            Type = "p";
            Gender = "m";
        }

        public Guid? PersonId { get; set; }
        public Guid CaseId { get; set; }
        public Guid? TypePartyId { get; set; }
        public string Comments { get; set; }
        public Guid? RegionId { get; set; }
        public Guid? EducationId { get; set; }
        public Guid? OccupationId { get; set; }
        public bool PleaBargain { get; set; }
        public bool Minor { get; set; }
        public Guid? CitizenshipId { get; set; }
        public Guid? CatId { get; set; }
        public string Region { get; set; }
        public string TypeActivity { get; set; }
        public string Function { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string SurName { get; set; }
        public string Idnp { get; set; }
        public string Type { get; set; }
        public string Gender { get; set; }
        public string Location { get; set; }
        public string Street { get; set; }
        public string Home { get; set; }
        public string Appartment { get; set; }
        public string Phone { get; set; }
        public string CellPhone { get; set; }
        public string Email { get; set; }
        public string ContactInfo { get; set; }
        public DateTime? DateOfBirth { get; set; }
    }

    public class File : DelEntity
    {
        public Guid EntityId { get; set; }
        public Guid? CaseId { get; set; }
        public virtual Case Case { get; set; } 
        public string Name { get; set; }
        public string Title { get; set; }
        public string Subject { get; set; }
        public DateTime? RegisteredOn { get; set; }
        public string Source { get; set; }
        public string SourceProtocolNumber { get; set; }
        public Guid? LanguageId { get; set; }
        public string InternalProtocolNumber { get; set; }
        public string ProtocolNumber { get; set; }
        public string ContentType { get; set; }
        public byte[] Bytes { get; set; }
        public int Length { get; set; }
    }


    public class Status : Entity
    {
        public Guid CaseId { get; set; }
        public virtual Case Case { get; set; }
        public string Code { get; set; }
        public DateTime DateFrom { get; set; }
        public DateTime? DateTo { get; set; }
        public Guid? GroundId { get; set; }
        public string Reason { get; set; }
    }

    public class Hearing : DelEntity
    {
        public Guid CaseId { get; set; }
        public virtual Case Case { get; set; }
        public Guid RoomId { get; set; }
        public virtual Room Room { get; set; }
        public Guid TypeId { get; set; }
        public virtual Parameter Type { get; set; }
        public DateTime Date { get; set; }
        public int Duration { get; set; }
        public DateTime DateEnd { get; set; }
        public bool IsSecret { get; set; }
        public bool StateLanguage { get; set; }
        public bool OnCasationRequestAdmisibility { get; set; }
        public virtual ICollection<Party> Parties { get; set; }
        [NotMapped]
        public ICollection<User> Users { get; set; }
    }

    public class Alert : Entity
    {
        public Guid? HearingId { get; set; }
        public virtual Hearing Hearing { get; set; }
        public string Title { get; set; }
        public string Message { get; set; }
    }

    public class AlertUser : Entity
    {
        public Guid AlertId { get; set; }
        public virtual Alert Alert { get; set; }
        public Guid UserId { get; set; }
        public virtual User User { get; set; }
        public DateTime? ReadOn { get; set; }
        public bool WasEmailed { get; set; }
        public bool WasReadOnce { get; set; }
    }

    public class Ruling : DelEntity
    {
        public Guid CaseId { get; set; }
        public virtual Case Case { get; set; }
        public Guid? FileId { get; set; }
        public virtual File File { get; set; }
        public Guid? HearingId { get; set; }
        public virtual Hearing Hearing { get; set; }
        public Guid? TemplateId { get; set; }
        public virtual Template Template { get; set; }
        public Guid? RulingTypeId { get; set; }
        public virtual Parameter RulingType { get; set; }
        public byte[] DocBytes { get; set; }
        public string Status { get; set; }
    }


}
